package com.yoi.SendAndRecv;

import com.rabbitmq.client.Channel;
import org.springframework.amqp.rabbit.annotation.*;
import org.springframework.messaging.handler.annotation.Headers;
import org.springframework.messaging.handler.annotation.Payload;
import org.springframework.stereotype.Component;

import java.util.Map;

//Version3

/**
 * Fanout发布模式（订阅模式）
 */
//@Component
@RabbitListener(bindings=@QueueBinding(value=@Queue(value="fanout-queue",durable="ture"),
        exchange=@Exchange(name="fanout-exchange",durable="true",type="fanout")),containerFactory = "ThirdContainerFactory")
public class Receiver3 {

    @RabbitHandler
    public void process(@Payload String body, @Headers Map<String,Object> headers, Channel channel) {
        System.out.println("Receiver3 : " + body);
    }

}